const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const assert = require("node:assert");

module.exports = {
    mode: "development",
    //入口
    entry: "./src/index.js",
    //出口(输出)
    output: {
        path: path.resolve(__dirname, "./dist1"),
        filename: "main3.js",
        clean: true,
    },

    module: {
        rules: [
            {
                test: /\.css$/,
                use:["style-loader", "css-loader"]
            },
            {
                test: /\.jpg$/,
                type: "asset/resource"
            },
            {
                test: /\.js$/,
                use: {
                    loader: "babel-loader",
                    options: {
                        presets:["@babel/preset-env"]
                    }
                }
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./src/index.html"
        })
    ],
    devServer: {
        open:true,
        watchFiles:["src/*.html"]
    }
}











